﻿#include "MyCustomPlot.h"

MyCustomPlot::MyCustomPlot(QWidget *parent) : QCustomPlot(parent),initViewRect_(QRect())
{

}

void MyCustomPlot::setInitViewRect(const QRect &rect)
{
    initViewRect_ = rect;
}

void MyCustomPlot::resizeEvent(QResizeEvent *event)
{
    if(!initViewRect_.isNull())
    {
        if(rect().width() < initViewRect_.width() || rect().height() < initViewRect_.height())
        {
            QWidget::resizeEvent(event);
            replot();
            return;
        }
        else
        {
            return QCustomPlot::resizeEvent(event);
        }
    }
    return QCustomPlot::resizeEvent(event);
}
